import { configureStore, combineReducers } from "@reduxjs/toolkit";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
// highlight-next-line
import ticketReducer from "./Slice/ticketSlice";
import userReducer from "./Slice/userSlice";

const persistConfig = {
  key: "root",
  storage,
};

const persistedReducer = persistReducer(
  persistConfig,
  combineReducers({
    ticket: ticketReducer,
    user: userReducer,
  })
);

const store = configureStore({
  reducer: persistedReducer,
  middleware: (m) => m({ serializableCheck: false }),
});

export default store;
export let persistor = persistStore(store);
